package com.example.Laboratory.Service.Impl;

import com.example.Laboratory.Entity.Open_subject;
import com.example.Laboratory.Mapper.Open_subjectMapper;
import com.example.Laboratory.Service.Open_subjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class Open_subjectServiceImpl implements Open_subjectService {

    @Autowired
    Open_subjectMapper open_subjectMapper;

    //添加开放课题
    @Override
    public String addOpen_subject(Open_subject t) {
        if (open_subjectMapper.addOpen_subject(t) == 1) {
            return "添加成功";
        } else {
            return "添加失败";
        }
    }
    //删除开放课题
    @Override
    public String deleteOpen_subject(int open_subject_id) {
        if (open_subjectMapper.deleteOpen_subject(open_subject_id) == 1) {
            return "删除成功";
        } else {
            return "删除失败";
        }
    }


    //查找开放课题
    @Override
    public List<Open_subject> selectOpen_subject() {
        return open_subjectMapper.researchOpen_subject();
    }

    //修改开放课题
    @Override
    public String updateOpen_subject(Open_subject i) {
        if (open_subjectMapper.reviseOpen_subject(i) == 1) {
            return "修改成功";
        } else {
            return "修改失败";
        }
    }
}